// compile: g++ -o list list.cc -std=c++11
// run: ./list
#include <iostream>
#include <list>
using namespace std;
void Print(list<int>& ls) {
  for (const auto& node : ls) {
    cout << node << " ";
  }
  cout << endl;
}
void Test1() {
  list<int> ls;
  ls.push_front(1);
  ls.push_back(100);
  ls.push_front(2);
  ls.push_back(99);
  auto it = find(ls.begin(), ls.end(), 100);
  ls.insert(it, 3);
  ls.erase(ls.begin());
  ls.pop_back();
  ls.pop_front();
  Print(ls);
  ls.reverse();
  Print(ls);
}
void Test2() {}
int main() {
  Test1();
  Test2();
  return 0;
}
